Laboratory Exercise: Using Git

In this course, we will use Github as our version control and repository system. The way in which we will use git and github are explained here

  1. If you have not already done so, read the general introduction to git found here, and the watch the video demonstration. (Alas, some of the details have changed since this video demo was made, but the ideas are the same).
  2. If you have not already done so, go to github.ccs.neu.edu and log in with your CCS credentials.
  3. If you have not already done so, download and install a github client. We recommend Github Desktop for Mac and Windows. We will refer to this as GHD. If you are using Linux, use the git package that came with your linux distribution. download and install a github client. We recommend Github Desktop for Mac and Windows.github.com/" >Github for Mac. If you are using Linux, use the git package that came with your linux distribution.
  4. Open GHD. You'll need to do the following steps in order to configure GHD. This part is slightly complicated, but you only have to do it once.

    1. Select "Github Enterprise".
    2. Enter your CCS login name (do not include "@ccs.neu.edu") and password, and enter "https://github.ccs.neu.edu" when it asks for the github server name.
    3. Go on to "configure git". This will display your CCS username and email. Accept these settings.
    4. It will next ask you about finding local repositories. If you want GHD to manage all your existing repositories, you can do this. Otherwise uncheck everything and skip this step.
    5. It will then give you some advice about "The Github Flow", which involves making lots of temporary branches. If you are familiar with github and know about this stuff, feel free to do what it says. Otherwise ignore it: your repositories will have a single branch, called "master". For a solo or pair project, this is all you need.
    6. Click on the "+" sign in the upper-left corner. Click on "create" to create a new local repository. It will ask you where to create it; choose whatever location you like, or accept the one that is offered. NOTE: when we create repositories for you, these should appear in the list of repositories, and you'll click on "clone" to create a local copy.
    7. Click on the little cloud in the upper right-hand corner that says "publish" to connect your local repo to the github server.
    8. GHD will say something like "No local changes; would you like to open this repository in Explorer?". Click to open the repo.

    You've now created your first repository, and you're ready to go.

  5. Add a text file to the repository, using the tool of your choice.
  6. Now go back to GHD. You should see a message that says "1 change" and another that says "1 uncommitted change" You should see the blue message in the upper right-hand corner that says "uncommitted changes". Click on the name of your new document to display the change. You'll see some diffs.
  7. Write a commit message. Informative commit messages are Good Things. Click on the checkbox for "Commit to Master".
  8. THIS NEXT PART IS VERY IMPORTANT! You see the little cloud in the upper right-hand corner that says "Sync". Do it! This uploads your changes to the server.
  9. To see that your changes have been uploaded, click on "tools" again. This time, select "view on github".
  10. A browser window should pop open with your repository. You should see your new file there.
  11. Now let's edit the file in the browser. Click on the file to view it, and then click on the little pencil to edit the file. A text window should open. Edit the file a little. Scroll down and change the commit message if you like, then select "commit directly to the 'master' branch". Then hit "commit changes."
  12. Now let's download those changes into your local copy. In GHD, if you are still looking at your repository, his "sync" to download the changes to your local copy of the repository. Open your local copy to confirm that the changes have arrived.
  13. Last, click on one of the little dots on the little thing that looks like a spaceship, just below the "sync" button. This will show the history display, where you can see the history of your commits. You can go back to the head of the spaceship to look at your current changes (right now there shouldn't be any).

Last modified: Wed Sep 9 11:44:34 Eastern Daylight Time 2015